package ArrayList;

import java.util.ArrayList;

public class Student_test {
    public static void main(String[] args) {
        ArrayList<Student> list=new ArrayList<>();

        Student stu1=new Student("zhangsan",22);
        Student stu2=new Student("lisi",28);
        Student stu3=new Student("wangwu",24);
        Student stu4=new Student("zhaoliu",26);

        list.add(stu1);
        list.add(stu2);
        list.add(stu3);
        list.add(stu4);

        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i).getName()+" "+list.get(i).getAge());
        }

    }



}
